// Sec-WebSocket-Accept的计算

let SecWebSocketKey = 'W68WpA1ZAQxraUmqgh0ZGQ=='
let SecWebSocketAccept = 'CNBDyUJGrSpOriXuo25yu944luE='


const crypto = require('crypto');
const CODE = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
function toAcceptKey(wsKey) {
    return crypto.createHash('sha1').update(wsKey + CODE).digest('base64');;
}
console.log(toAcceptKey(SecWebSocketKey) === SecWebSocketAccept); //true